package com.example.zhaoping.serviceImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.zhaoping.entity.Menu;
import com.example.zhaoping.mapper.MenuMapper;
import com.example.zhaoping.service.MenuService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class MenuServiceImpl implements MenuService {

    @Resource
    private MenuMapper menuMapper;

    @Override
    public int inster(Menu menu) {
        return menuMapper.insert(menu);
    }

    @Override
    public Menu selectByUrl(String url) {
        QueryWrapper<Menu> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("url",url);
        return menuMapper.selectOne(queryWrapper);
    }

    @Override
    public int upData(Menu menu) {
        return menuMapper.updateById(menu);
    }
}
